import Vue from 'vue'
//路由方法集
import VRouter from 'vue-router'
//首页
import index from '../App'
//404页面
import NotFoundComponent from '../components/other/NotFoundComponent'
//登录注册模块(暂时没有设计图) 

//客户端模块
import clientele from '../components/clientele/clienteleIndex'
//我的
import mycenter from '../components/clientele/mypage/mycenter'
//收货地址
import addAddress from '../components/clientele/mypage/addAddress'
//添加收货地址 
import saveAddres from '../components/clientele/mypage/saveAddres'
//我的足迹
import myfootprint from '../components/clientele/mypage/myfootprint'
//我关注的店铺
import tionshopp from '../components/clientele/mypage/tionshopp'
//我的订单
import orderAll from '../components/clientele/mypage/orderAll'
//我的订单详情
import orderDetail from '../components/clientele/mypage/orderDetail'
//我的收藏夹
import favorite from '../components/clientele/mypage/favorite'
//我的消费明细
import consumerDetail from '../components/clientele/mypage/consumerDetail' 
//分享拼团商品 
import streaGoods from '../components/clientele/mypage/streaGoods'
//首页
import home from '../components/clientele/homepage/home'
//商品详情
import goodsDetails from '../components/clientele/homepage/goodsDetails'
//确认订单
import confirmOrder from '../components/clientele/homepage/confirmOrder'
//商家端模块
import merchant from '../components/merchant/merchantIndex'
//商家管理中心 
import userCenter from '../components/merchant/userpage/userCenter'
//商家我的钱包
import userWallet from '../components/merchant/userpage/userWallet'
//商家订单管理
import userOrder from '../components/merchant/userpage/userOrder'
//商家订单详情
import userOrderDetail from '../components/merchant/userpage/userOrderDetail'
//商家我的店铺二维码
import storeCode from '../components/merchant/userpage/storeCode' 
//商家店铺装修
import decoration from '../components/merchant/userpage/decoration'
//商家我的商品二维码
import goodsCode from '../components/merchant/userpage/goodsCode'
//商家 商品管理
import manageGoods from '../components/merchant/userpage/manageGoods'
//商家 商品发布/编辑
import redactGoods from '../components/merchant/userpage/redactGoods'

Vue.use(VRouter) 
let router = new VRouter({
	mode: 'history',
	routes: [{
			path: '/', 
			redirect: '/merchant',
			component: index
		},
		{
			path: '*',
			name: '404页面',
			redirect: '/clientele',
			component: NotFoundComponent
		},
		{
			path: '/clientele',
			name: '客户端入口', 
			component: clientele,
			redirect: '/clientele/home',
			children: [
				{
					path: '/clientele/home',
					name:'首页',
					component: home, 
				},
				{
					path: '/clientele/goodsDetails',
					name:'商品详情',
					component: goodsDetails,
					children:[
		 				{
		 					path:':shopId'
		 				}
		 			]
				},
				{
					path: '/clientele/mycenter',
					name: '个人中心',
					component: mycenter 
				},
				{
					path:'/clientele/confirmOrder',
					name:'确认订单',
					component:confirmOrder,
					children:[
		 				{
		 					path:':goodsId/:joinType/:orderRecordId'
		 				}
		 			]
				},
				{	
					path:'/clientele/addAddress',
					name:'收货地址',
					component:addAddress 
				},
				{	
					path:'/clientele/saveAddres',
					name:'添加收货地址',
					component:saveAddres,
					children:[
		 				{
		 					path:':IDdata'
		 				}
		 			]
				},
				{	
					path:'/clientele/myfootprint',
					name:'我的足迹',
					component:myfootprint 
				},
				{	
					path:'/clientele/tionshopp',
					name:'我关注的店铺',
					component:tionshopp 
				},
				{	
					path:'/clientele/orderAll',
					name:'我的订单',
					component:orderAll,
					children:[
		 				{
		 					path:':status'
		 				}
		 			]
				},
				{	
					path:'/clientele/orderDetail',
					name:'订单详情',
					component:orderDetail,
					children:[
		 				{
		 					path:':orderID'
		 				}
		 			] 
				},
				{	
					path:'/clientele/favorite',
					name:'收藏夹',
					component:favorite 
				},
				{	
					path:'/clientele/consumerDetail',
					name:'消费明细',
					component:consumerDetail 
				},
				{	
					path:'/clientele/streaGoods',
					name:'分享商品',
					component:streaGoods, 
					children:[
		 				{
		 					path:':orderID/:isTyoe'
		 				}
		 			] 
				}
				
				
			]
		},
		
		{
			path: '/merchant',
			name: '商家首页',
			component: merchant,
			redirect: '/merchant/userCenter',
			children: [
				{
					path:'/merchant/userCenter',
					name:'商家中心',
					component:userCenter
				},
				{
					path:'/merchant/userWallet',
					name:'我的钱包',
					component:userWallet
				},
				{
					path:'/merchant/userOrder',
					name:'订单管理',
					component:userOrder
				},
				{
					path:'/merchant/userOrderDetail',
					name:'商家订单详情',
					component:userOrderDetail, 
					children:[
		 				{
		 					path:':orderID'
		 				}
		 			] 
				},
				{
					path:'/merchant/storeCode',
					name:'我的店铺二维码',
					component:storeCode
				},
				{
					path:'/merchant/decoration',
					name:'店铺装修',
					component:decoration
				},
				{
					path:'/merchant/goodsCode',
					name:'我的商品二维码',
					component:goodsCode,
					children:[
		 				{
		 					path:':GoodsId/:shopId'
		 				}
		 			] 
				},
				{
					path:'/merchant/manageGoods',
					name:'商品管理',
					component:manageGoods
				},
				{
					path:'/merchant/redactGoods',
					name:'商品发布',
					component:redactGoods,
					children:[
		 				{
		 					path:':GoodsId'
		 				}
		 			]  
				}
				
			]
		}



	]
});
router.afterEach(function(transition) {
	if(transition.name) {
		document.title = transition.name;
	}
}); 

export default router;